﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using KPIS.GERP.GHRMS.DAL;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public sealed class MasNationalitiesBLL : IMasNationalitiesBLL
    {
        private static readonly IMasNationalitiesDAL DAL = DataAccess.CreateMasterNationalities();

        public IList<MasNationalitiesInfo> ListNationalities()
        {
            return DAL.ListNationalities(new MasNationalitiesInfo(0));
        }
        public IList<MasNationalitiesInfo> ListNationalities(string Sequence)
        {
            int Seq = Sequence.Length > 0 ? Int32.Parse(Sequence) : 0;
            return DAL.ListNationalities(new MasNationalitiesInfo(Seq));
        }
        public void Insert(string Name, string NameEng, int CreatedBy)
        {
            try
            {
                DAL.Insert(new MasNationalitiesInfo(0, Name, NameEng, "", CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, string NameEng, int UpdatedBy)
        {
            try
            {
                DAL.Update(new MasNationalitiesInfo(Sequence, Name, NameEng, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
    }
}
